<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function getSuffix(url){
        const str1 = url.substring(url.lastIndexOf('.') + 1)
        const str2 = url.split('.').pop()
        return {str1,str2}
    }

    console.log(getSuffix("https://www.baidu.com/index.html"))
</script>
</html>